package mysql

import (
	"gorm.io/gorm"
	"week2a/models/global"
)

type VideoWeek2 struct {
	gorm.Model
	VideoTitle        string `gorm:"type:varchar(30);comment:视频标题;"`
	VideoIntroduction string `gorm:"type:varchar(100);comment:视频简介;"`
	VideoAddress      string `gorm:"type:varchar(255);comment:视频播放地址;"`
	VideoStatus       int    `gorm:"type:tinyint(2);comment:视频状态;"`
}

func CreateVideo() {
	global.DB.Exec("INSERT INTO `video_week2` (`created_at`,`updated_at`,`deleted_at`,`video_title`,`video_introduction`,`video_address`,`video_status`) " +
		"VALUES ('2024-11-25 10:21:07.855','2024-11-25 10:21:07.855',NULL,'视频标题4','视频简介3','视频播放地址3',0) " +
		"VALUES ('NULL','NULL',NULL,'视频标题5','视频简介5','视频播放地址5',0)")

}

// 查询视频列表
func GetVideoList() []VideoWeek2 {
	var list []VideoWeek2
	global.DB.Find(&list)
	return list
}
